package edu.zut.controller;

import edu.zut.pojo.Employee;
import edu.zut.pojo.Page;
import edu.zut.service.EmpService;
import edu.zut.service.impl.EmpServiceImpl;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.List;

//全部员工信息的查询
@WebServlet(name = "ShowAllEmpServlet", value = "/emp/show")
public class ShowAllEmpServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //在此完成查询全部员工信息的功能,带分页参数
        EmpService empService = new EmpServiceImpl();
        List<Employee> employeeList = empService.showAllEmp();
        //返回home主页，同时携带信息
        request.setAttribute("empList",employeeList);
        request.getRequestDispatcher("/view/home.jsp").forward(request,response);

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
